//
//  HomeheadView.m
//  RONGAO
//
//  Created by wei wang on 2017/2/22.
//  Copyright © 2017年 wei wang. All rights reserved.
//

#import "HomeheadView.h"

@interface HomeheadView ()<SDCycleScrollViewDelegate>


@end
@implementation HomeheadView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)init{
    
    if ([super init]) {
        
        [self masLayoutSubview];
        
    }
    
    return self;
}

- (void)setSDCycleScrollViewGroupImage:(NSArray *)arrayImage{
    
    self.bannerView.localizationImageNamesGroup = arrayImage;
    
}
#pragma mark - SDCycleScrollViewDelegate 如果需要增加点击事件

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
    
}

- (void)masLayoutSubview{
    
    __weak UIView *superView = self;
    [self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.edges.mas_equalTo(superView);
        
    }];
    
    [self.pushBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(superView.mas_centerX);
        make.bottom.mas_equalTo(superView.mas_bottom).mas_offset(-25);
        
    }];
}

- (SDCycleScrollView *)bannerView{
    
    if (!_bannerView) {
        _bannerView = [[SDCycleScrollView alloc] init];
        _bannerView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
        _bannerView.delegate = self;
        _bannerView.currentPageDotColor = [UIColor colorWithRed:208/255.0 green:182/255.0 blue:107/255.0 alpha:1]; // 自定义分页控件小圆标颜色
        _bannerView.placeholderImage = [UIImage imageNamed:@"placeholder"];
        
        [self addSubview:_bannerView];
    }
    
    return _bannerView;
}

- (UIButton *)pushBtn{
    
    if (!_pushBtn) {
        
        _pushBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_pushBtn setImage:[UIImage imageNamed:@"bg_know_nor"] forState:UIControlStateNormal];
        [self addSubview:_pushBtn];
    }
    
    return _pushBtn;
}

@end
